package com.zy.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xyz
 */
@Configuration
public class MpPagingConfig {

    /**
     * <bean id="mybatisPlusInterceptor" class="com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor"/>
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        // Mp的拦截器
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        // Mp分页相关的内置拦截器
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
        // 将 Mp分页相关的内置拦截器 添加到 Mp的拦截器 中
        mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
        return mybatisPlusInterceptor;
    }

//    @Configuration
//    public class IClientConfig {
//
//        @Bean
//        public DefaultClientConfigImpl iClientConfig(){
//            return new DefaultClientConfigImpl();
//        }
//    }
}
